class BannerTexts {
    constructor() {
        this.children = [];
        this.element = null;
    }

    init() {
        throw new Error('请重写你的方法')
    }

    add() {
        throw new Error('请重写你的方法')
    }

    getElement() {
        throw new Error('请重写你的方法')
    }
}

export class BannerTextsWarp extends BannerTexts{
    constructor({
        parent,
        id,
    }) {
        super();
        this.parent = parent;
        this.id = id;
        this.init();
    }

    init() {
        this.element = document.createElement('div');
        this.element.id = this.id;
        this.element.className = 'banner-text-wrap';
    }

    add(child) {
        this.children.push(child);
        this.element.appendChild(child.getElement());
        return this
    }

    getElement() {
        return this.element;
    }

    show() {
        this.parent.appendChild(this.element);
    }
}

export class Item extends BannerTexts {
    constructor({
        className
    }) {
        super();
        this.className = className;
        this.init();
    }

    init() {
        this.element = document.createElement('div');
        this.element.className = this.className;
    }

    add(child) {
        this.children.push(child);
        this.element.appendChild(child.getElement());
        return this
    }

    getElement() {
        return this.element;
    }
}

export class NormalText extends BannerTexts {
    constructor({
        className
    }) {
        super();
        this.className = className;
        this.init();
    }

    init() {
        this.element = document.createElement('p');
        this.element.className = this.className;

    }

    add() {

    }

    getElement() {
        return this.element;
    }
}